SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE VIEW dbo.vwtEmbargos
AS
SELECT        dbo.tb_Embargos.idEmbargo AS ID, dbo.tb_Embargos.Agente, dbo.tb_Embargos.Desde, dbo.tb_Embargos.Hasta, 
                         dbo.tb_TiposDeEmbargos.Descripcion AS TiposDeEmbargos, dbo.tb_FormulasDeDescuento.Descripcion AS FormulaDeDescuento, 
                         dbo.tb_Bancos.Descripcion AS Bancos, dbo.tb_Embargos.MontoTotal, dbo.tb_Embargos.MontoMensual, dbo.tb_Embargos.Porcentaje, 
                         dbo.tb_Embargos.CuentaDestino
FROM            dbo.tb_Embargos INNER JOIN
                         dbo.tb_TiposDeEmbargos ON dbo.tb_Embargos.TipoEmbargo = dbo.tb_TiposDeEmbargos.idTipoEmbargo INNER JOIN
                         dbo.tb_Bancos ON dbo.tb_Embargos.Banco = dbo.tb_Bancos.idBanco INNER JOIN
                         dbo.tb_FormulasDeDescuento ON dbo.tb_Embargos.FormulaDeDescuento = dbo.tb_FormulasDeDescuento.IdFormula INNER JOIN
                         dbo.tb_Juzgados ON dbo.tb_Embargos.Juzgado = dbo.tb_Juzgados.idJuzgado
GO
GRANT SELECT ON  [dbo].[vwtEmbargos] TO [AdministracionSagenet]
GRANT SELECT ON  [dbo].[vwtEmbargos] TO [adm-sage]
GO
